package org.hust.app.contract;

import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import org.fisco.bcos.sdk.abi.FunctionReturnDecoder;
import org.fisco.bcos.sdk.abi.TypeReference;
import org.fisco.bcos.sdk.abi.datatypes.DynamicArray;
import org.fisco.bcos.sdk.abi.datatypes.Event;
import org.fisco.bcos.sdk.abi.datatypes.Function;
import org.fisco.bcos.sdk.abi.datatypes.Type;
import org.fisco.bcos.sdk.abi.datatypes.Utf8String;
import org.fisco.bcos.sdk.abi.datatypes.generated.Int256;
import org.fisco.bcos.sdk.abi.datatypes.generated.tuples.generated.Tuple1;
import org.fisco.bcos.sdk.abi.datatypes.generated.tuples.generated.Tuple2;
import org.fisco.bcos.sdk.client.Client;
import org.fisco.bcos.sdk.contract.Contract;
import org.fisco.bcos.sdk.crypto.CryptoSuite;
import org.fisco.bcos.sdk.crypto.keypair.CryptoKeyPair;
import org.fisco.bcos.sdk.eventsub.EventCallback;
import org.fisco.bcos.sdk.model.CryptoType;
import org.fisco.bcos.sdk.model.TransactionReceipt;
import org.fisco.bcos.sdk.model.callback.TransactionCallback;
import org.fisco.bcos.sdk.transaction.model.exception.ContractException;

@SuppressWarnings("unchecked")
public class DetailCRUD extends Contract {
    public static final String[] BINARY_ARRAY = {"60806040523480156200001157600080fd5b506110016000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166356004b6a6040805190810160405280600581526020017f676f6f64730000000000000000000000000000000000000000000000000000008152506040518263ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004016200010191906200024a565b602060405180830381600087803b1580156200011c57600080fd5b505af115801562000131573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525062000157919081019062000174565b50620002f4565b60006200016c8251620002a3565b905092915050565b6000602082840312156200018757600080fd5b600062000197848285016200015e565b91505092915050565b6000620001ad8262000298565b808452620001c3816020860160208601620002ad565b620001ce81620002e3565b602085010191505092915050565b6000600482527f61747472000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000600382527f75696400000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b60006060820190508181036000830152620002668184620001a0565b905081810360208301526200027b8162000213565b905081810360408301526200029081620001dc565b905092915050565b600081519050919050565b6000819050919050565b60005b83811015620002cd578082015181840152602081019050620002b0565b83811115620002dd576000848401525b50505050565b6000601f19601f8301169050919050565b6112dc80620003046000396000f30060806040526004361061004c576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306e63ff814610051578063fcd7e3c11461008e575b600080fd5b34801561005d57600080fd5b5061007860048036036100739190810190610dbc565b6100cc565b6040516100859190610fd4565b60405180910390f35b34801561009a57600080fd5b506100b560048036036100b09190810190610d3a565b61046b565b6040516100c3929190610f9d565b60405180910390f35b6000806000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f23f63c96040805190810160405280600581526020017f676f6f64730000000000000000000000000000000000000000000000000000008152506040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040161017d9190610fef565b602060405180830381600087803b15801561019757600080fd5b505af11580156101ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506101cf9190810190610ce8565b92508273ffffffffffffffffffffffffffffffffffffffff166313db93466040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561023557600080fd5b505af1158015610249573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061026d9190810190610cbf565b91508173ffffffffffffffffffffffffffffffffffffffff1663e942b516876040518263ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004016102c491906110e6565b600060405180830381600087803b1580156102de57600080fd5b505af11580156102f2573d6000803e3d6000fd5b505050508173ffffffffffffffffffffffffffffffffffffffff1663e942b516866040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040161034b9190611091565b600060405180830381600087803b15801561036557600080fd5b505af1158015610379573d6000803e3d6000fd5b505050508273ffffffffffffffffffffffffffffffffffffffff166331afac3687846040518363ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004016103d4929190611041565b602060405180830381600087803b1580156103ee57600080fd5b505af1158015610402573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506104269190810190610d11565b90507fc57b01fa77f41df77eaab79a0e2623fab2e7ae3e9530d9b1cab225ad65f2b7ce816040516104579190610fd4565b60405180910390a180935050505092915050565b60608060008060006060806000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f23f63c96040805190810160405280600581526020017f676f6f64730000000000000000000000000000000000000000000000000000008152506040518263ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004016105249190610fef565b602060405180830381600087803b15801561053e57600080fd5b505af1158015610552573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506105769190810190610ce8565b96508673ffffffffffffffffffffffffffffffffffffffff16637857d7c96040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b1580156105dc57600080fd5b505af11580156105f0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506106149190810190610c6d565b95508673ffffffffffffffffffffffffffffffffffffffff1663e8434e398b886040518363ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040161066d929190611011565b602060405180830381600087803b15801561068757600080fd5b505af115801561069b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506106bf9190810190610c96565b94508473ffffffffffffffffffffffffffffffffffffffff1663949d225d6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561072557600080fd5b505af1158015610739573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061075d9190810190610d11565b60405190808252806020026020018201604052801561079057816020015b606081526020019060019003908161077b5790505b5093508473ffffffffffffffffffffffffffffffffffffffff1663949d225d6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b1580156107f757600080fd5b505af115801561080b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061082f9190810190610d11565b60405190808252806020026020018201604052801561086257816020015b606081526020019060019003908161084d5790505b509250600091505b8473ffffffffffffffffffffffffffffffffffffffff1663949d225d6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b1580156108ce57600080fd5b505af11580156108e2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506109069190810190610d11565b821215610b4b578473ffffffffffffffffffffffffffffffffffffffff1663846719e0836040518263ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004016109629190610fd4565b602060405180830381600087803b15801561097c57600080fd5b505af1158015610990573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506109b49190810190610cbf565b90508073ffffffffffffffffffffffffffffffffffffffff16639c981fcb6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401610a09906110c6565b600060405180830381600087803b158015610a2357600080fd5b505af1158015610a37573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f82011682018060405250610a609190810190610d7b565b8483815181101515610a6e57fe5b906020019060200201819052508073ffffffffffffffffffffffffffffffffffffffff16639c981fcb6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401610ace90611071565b600060405180830381600087803b158015610ae857600080fd5b505af1158015610afc573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f82011682018060405250610b259190810190610d7b565b8383815181101515610b3357fe5b9060200190602002018190525081600101915061086a565b83839850985050505050505050915091565b6000610b6982516111d9565b905092915050565b6000610b7d82516111eb565b905092915050565b6000610b9182516111fd565b905092915050565b6000610ba5825161120f565b905092915050565b6000610bb98251611221565b905092915050565b600082601f8301121515610bd457600080fd5b8135610be7610be282611148565b61111b565b91508082526020830160208301858383011115610c0357600080fd5b610c0e83828461124f565b50505092915050565b600082601f8301121515610c2a57600080fd5b8151610c3d610c3882611148565b61111b565b91508082526020830160208301858383011115610c5957600080fd5b610c6483828461125e565b50505092915050565b600060208284031215610c7f57600080fd5b6000610c8d84828501610b5d565b91505092915050565b600060208284031215610ca857600080fd5b6000610cb684828501610b71565b91505092915050565b600060208284031215610cd157600080fd5b6000610cdf84828501610b85565b91505092915050565b600060208284031215610cfa57600080fd5b60","00610d0884828501610b99565b91505092915050565b600060208284031215610d2357600080fd5b6000610d3184828501610bad565b91505092915050565b600060208284031215610d4c57600080fd5b600082013567ffffffffffffffff811115610d6657600080fd5b610d7284828501610bc1565b91505092915050565b600060208284031215610d8d57600080fd5b600082015167ffffffffffffffff811115610da757600080fd5b610db384828501610c17565b91505092915050565b60008060408385031215610dcf57600080fd5b600083013567ffffffffffffffff811115610de957600080fd5b610df585828601610bc1565b925050602083013567ffffffffffffffff811115610e1257600080fd5b610e1e85828601610bc1565b9150509250929050565b6000610e3382611181565b80845260208401935083602082028501610e4c85611174565b60005b84811015610e85578383038852610e67838351610ef9565b9250610e72826111a2565b9150602088019750600181019050610e4f565b508196508694505050505092915050565b610e9f8161122b565b82525050565b610eae8161123d565b82525050565b610ebd816111cf565b82525050565b6000610ece82611197565b808452610ee281602086016020860161125e565b610eeb81611291565b602085010191505092915050565b6000610f048261118c565b808452610f1881602086016020860161125e565b610f2181611291565b602085010191505092915050565b6000600482527f61747472000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000600382527f75696400000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b60006040820190508181036000830152610fb78185610e28565b90508181036020830152610fcb8184610e28565b90509392505050565b6000602082019050610fe96000830184610eb4565b92915050565b600060208201905081810360008301526110098184610ef9565b905092915050565b6000604082019050818103600083015261102b8185610ec3565b905061103a6020830184610e96565b9392505050565b6000604082019050818103600083015261105b8185610ec3565b905061106a6020830184610ea5565b9392505050565b6000602082019050818103600083015261108a81610f2f565b9050919050565b600060408201905081810360008301526110aa81610f2f565b905081810360208301526110be8184610ec3565b905092915050565b600060208201905081810360008301526110df81610f66565b9050919050565b600060408201905081810360008301526110ff81610f66565b905081810360208301526111138184610ec3565b905092915050565b6000604051905081810181811067ffffffffffffffff8211171561113e57600080fd5b8060405250919050565b600067ffffffffffffffff82111561115f57600080fd5b601f19601f8301169050602081019050919050565b6000602082019050919050565b600081519050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b60006111e4826111af565b9050919050565b60006111f6826111af565b9050919050565b6000611208826111af565b9050919050565b600061121a826111af565b9050919050565b6000819050919050565b6000611236826111af565b9050919050565b6000611248826111af565b9050919050565b82818337600083830152505050565b60005b8381101561127c578082015181840152602081019050611261565b8381111561128b576000848401525b50505050565b6000601f19601f83011690509190505600a265627a7a7230582016deb64f9a3bc3ebe30b9810ed314cb74a06f9e2319283c65abe2f51c05379a76c6578706572696d656e74616cf50037"};

    public static final String BINARY = org.fisco.bcos.sdk.utils.StringUtils.joinAll("", BINARY_ARRAY);

    public static final String[] SM_BINARY_ARRAY = {"60806040523480156200001157600080fd5b506110016000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c92a78016040805190810160405280600581526020017f676f6f64730000000000000000000000000000000000000000000000000000008152506040518263ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004016200010191906200024a565b602060405180830381600087803b1580156200011c57600080fd5b505af115801562000131573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525062000157919081019062000174565b50620002f4565b60006200016c8251620002a3565b905092915050565b6000602082840312156200018757600080fd5b600062000197848285016200015e565b91505092915050565b6000620001ad8262000298565b808452620001c3816020860160208601620002ad565b620001ce81620002e3565b602085010191505092915050565b6000600382527f75696400000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000600482527f61747472000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b60006060820190508181036000830152620002668184620001a0565b905081810360208301526200027b81620001dc565b90508181036040830152620002908162000213565b905092915050565b600081519050919050565b6000819050919050565b60005b83811015620002cd578082015181840152602081019050620002b0565b83811115620002dd576000848401525b50505050565b6000601f19601f8301169050919050565b6112dc80620003046000396000f30060806040526004361061004c576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680635b325d7814610051578063ce0a9fb91461008f575b600080fd5b34801561005d57600080fd5b5061007860048036036100739190810190610d3a565b6100cc565b604051610086929190610f9d565b60405180910390f35b34801561009b57600080fd5b506100b660048036036100b19190810190610dbc565b6107be565b6040516100c39190610fd4565b60405180910390f35b60608060008060006060806000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166359a48b656040805190810160405280600581526020017f676f6f64730000000000000000000000000000000000000000000000000000008152506040518263ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004016101859190610fef565b602060405180830381600087803b15801561019f57600080fd5b505af11580156101b3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506101d79190810190610ce8565b96508673ffffffffffffffffffffffffffffffffffffffff1663c74f8caf6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561023d57600080fd5b505af1158015610251573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506102759190810190610c6d565b95508673ffffffffffffffffffffffffffffffffffffffff1663d8ac59578b886040518363ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004016102ce929190611011565b602060405180830381600087803b1580156102e857600080fd5b505af11580156102fc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506103209190810190610c96565b94508473ffffffffffffffffffffffffffffffffffffffff1663d3e9af5a6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561038657600080fd5b505af115801561039a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506103be9190810190610d11565b6040519080825280602002602001820160405280156103f157816020015b60608152602001906001900390816103dc5790505b5093508473ffffffffffffffffffffffffffffffffffffffff1663d3e9af5a6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561045857600080fd5b505af115801561046c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506104909190810190610d11565b6040519080825280602002602001820160405280156104c357816020015b60608152602001906001900390816104ae5790505b509250600091505b8473ffffffffffffffffffffffffffffffffffffffff1663d3e9af5a6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561052f57600080fd5b505af1158015610543573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506105679190810190610d11565b8212156107ac578473ffffffffffffffffffffffffffffffffffffffff16633dd2b614836040518263ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004016105c39190610fd4565b602060405180830381600087803b1580156105dd57600080fd5b505af11580156105f1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506106159190810190610cbf565b90508073ffffffffffffffffffffffffffffffffffffffff16639bca41e86040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040161066a90611071565b600060405180830381600087803b15801561068457600080fd5b505af1158015610698573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f820116820180604052506106c19190810190610d7b565b84838151811015156106cf57fe5b906020019060200201819052508073ffffffffffffffffffffffffffffffffffffffff16639bca41e86040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040161072f906110c6565b600060405180830381600087803b15801561074957600080fd5b505af115801561075d573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f820116820180604052506107869190810190610d7b565b838381518110151561079457fe5b906020019060200201819052508160010191506104cb565b83839850985050505050505050915091565b6000806000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166359a48b656040805190810160405280600581526020017f676f6f64730000000000000000000000000000000000000000000000000000008152506040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040161086f9190610fef565b602060405180830381600087803b15801561088957600080fd5b505af115801561089d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506108c19190810190610ce8565b92508273ffffffffffffffffffffffffffffffffffffffff16635887ab246040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561092757600080fd5b505af115801561093b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061095f9190810190610cbf565b91508173ffffffffffffffffffffffffffffffffffffffff16631a391cb4876040518263ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004016109b69190611091565b600060405180830381600087803b1580156109d057600080fd5b505af11580156109e4573d6000803e3d6000fd5b505050508173ffffffffffffffffffffffffffffffffffffffff16631a391cb4866040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401610a3d91906110e6565b600060405180830381600087803b158015610a5757600080fd5b505af1158015610a6b573d6000803e3d6000fd5b505050508273ffffffffffffffffffffffffffffffffffffffff16634c6f30c087846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401610ac6929190611041565b602060405180830381600087803b158015610ae057600080fd5b505af1158015610af4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610b189190810190610d11565b90507fdfc533ec2b52797a1229dc2495dbd3f4948f7c4c982ec077ad9d80810ec5c1f981604051610b499190610fd4565b60405180910390a180935050505092915050565b6000610b6982516111d9565b905092915050565b6000610b7d82516111eb565b905092915050565b6000610b9182516111fd565b905092915050565b6000610ba5825161120f565b905092915050565b6000610bb98251611221565b905092915050565b600082601f8301121515610bd457600080fd5b8135610be7610be282611148565b61111b565b91508082526020830160208301858383011115610c0357600080fd5b610c0e83828461124f565b50505092915050565b600082601f8301121515610c2a57600080fd5b8151610c3d610c3882611148565b61111b565b91508082526020830160208301858383011115610c5957600080fd5b610c6483828461125e565b50505092915050565b600060208284031215610c7f57600080fd5b6000610c8d84828501610b5d565b91505092915050565b600060208284031215610ca857600080fd5b6000610cb684828501610b71565b91505092915050565b600060208284031215610cd157600080fd5b6000610cdf84828501610b85565b91505092915050565b600060208284031215610cfa57600080fd5b60","00610d0884828501610b99565b91505092915050565b600060208284031215610d2357600080fd5b6000610d3184828501610bad565b91505092915050565b600060208284031215610d4c57600080fd5b600082013567ffffffffffffffff811115610d6657600080fd5b610d7284828501610bc1565b91505092915050565b600060208284031215610d8d57600080fd5b600082015167ffffffffffffffff811115610da757600080fd5b610db384828501610c17565b91505092915050565b60008060408385031215610dcf57600080fd5b600083013567ffffffffffffffff811115610de957600080fd5b610df585828601610bc1565b925050602083013567ffffffffffffffff811115610e1257600080fd5b610e1e85828601610bc1565b9150509250929050565b6000610e3382611181565b80845260208401935083602082028501610e4c85611174565b60005b84811015610e85578383038852610e67838351610ef9565b9250610e72826111a2565b9150602088019750600181019050610e4f565b508196508694505050505092915050565b610e9f8161122b565b82525050565b610eae8161123d565b82525050565b610ebd816111cf565b82525050565b6000610ece82611197565b808452610ee281602086016020860161125e565b610eeb81611291565b602085010191505092915050565b6000610f048261118c565b808452610f1881602086016020860161125e565b610f2181611291565b602085010191505092915050565b6000600382527f75696400000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000600482527f61747472000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b60006040820190508181036000830152610fb78185610e28565b90508181036020830152610fcb8184610e28565b90509392505050565b6000602082019050610fe96000830184610eb4565b92915050565b600060208201905081810360008301526110098184610ef9565b905092915050565b6000604082019050818103600083015261102b8185610ec3565b905061103a6020830184610e96565b9392505050565b6000604082019050818103600083015261105b8185610ec3565b905061106a6020830184610ea5565b9392505050565b6000602082019050818103600083015261108a81610f2f565b9050919050565b600060408201905081810360008301526110aa81610f2f565b905081810360208301526110be8184610ec3565b905092915050565b600060208201905081810360008301526110df81610f66565b9050919050565b600060408201905081810360008301526110ff81610f66565b905081810360208301526111138184610ec3565b905092915050565b6000604051905081810181811067ffffffffffffffff8211171561113e57600080fd5b8060405250919050565b600067ffffffffffffffff82111561115f57600080fd5b601f19601f8301169050602081019050919050565b6000602082019050919050565b600081519050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b60006111e4826111af565b9050919050565b60006111f6826111af565b9050919050565b6000611208826111af565b9050919050565b600061121a826111af565b9050919050565b6000819050919050565b6000611236826111af565b9050919050565b6000611248826111af565b9050919050565b82818337600083830152505050565b60005b8381101561127c578082015181840152602081019050611261565b8381111561128b576000848401525b50505050565b6000601f19601f83011690509190505600a265627a7a7230582026acca3448c7e20fba9e9d00e497f77f08f3c64e4ed9793777faa9f555b326f06c6578706572696d656e74616cf50037"};

    public static final String SM_BINARY = org.fisco.bcos.sdk.utils.StringUtils.joinAll("", SM_BINARY_ARRAY);

    public static final String[] ABI_ARRAY = {"[{\"constant\":false,\"inputs\":[{\"name\":\"uid\",\"type\":\"string\"},{\"name\":\"attr\",\"type\":\"string\"}],\"name\":\"insert\",\"outputs\":[{\"name\":\"\",\"type\":\"int256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"uid\",\"type\":\"string\"}],\"name\":\"select\",\"outputs\":[{\"name\":\"\",\"type\":\"string[]\"},{\"name\":\"\",\"type\":\"string[]\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"count\",\"type\":\"int256\"}],\"name\":\"InsertResult\",\"type\":\"event\"}]"};

    public static final String ABI = org.fisco.bcos.sdk.utils.StringUtils.joinAll("", ABI_ARRAY);

    public static final String FUNC_INSERT = "insert";

    public static final String FUNC_SELECT = "select";

    public static final Event INSERTRESULT_EVENT = new Event("InsertResult", 
            Arrays.<TypeReference<?>>asList(new TypeReference<Int256>() {}));
    ;

    protected DetailCRUD(String contractAddress, Client client, CryptoKeyPair credential) {
        super(getBinary(client.getCryptoSuite()), contractAddress, client, credential);
    }

    public static String getBinary(CryptoSuite cryptoSuite) {
        return (cryptoSuite.getCryptoTypeConfig() == CryptoType.ECDSA_TYPE ? BINARY : SM_BINARY);
    }

    public TransactionReceipt insert(String uid, String attr) {
        final Function function = new Function(
                FUNC_INSERT, 
                Arrays.<Type>asList(new org.fisco.bcos.sdk.abi.datatypes.Utf8String(uid), 
                new org.fisco.bcos.sdk.abi.datatypes.Utf8String(attr)), 
                Collections.<TypeReference<?>>emptyList());
        return executeTransaction(function);
    }

    public byte[] insert(String uid, String attr, TransactionCallback callback) {
        final Function function = new Function(
                FUNC_INSERT, 
                Arrays.<Type>asList(new org.fisco.bcos.sdk.abi.datatypes.Utf8String(uid), 
                new org.fisco.bcos.sdk.abi.datatypes.Utf8String(attr)), 
                Collections.<TypeReference<?>>emptyList());
        return asyncExecuteTransaction(function, callback);
    }

    public String getSignedTransactionForInsert(String uid, String attr) {
        final Function function = new Function(
                FUNC_INSERT, 
                Arrays.<Type>asList(new org.fisco.bcos.sdk.abi.datatypes.Utf8String(uid), 
                new org.fisco.bcos.sdk.abi.datatypes.Utf8String(attr)), 
                Collections.<TypeReference<?>>emptyList());
        return createSignedTransaction(function);
    }

    public Tuple2<String, String> getInsertInput(TransactionReceipt transactionReceipt) {
        String data = transactionReceipt.getInput().substring(10);
        final Function function = new Function(FUNC_INSERT, 
                Arrays.<Type>asList(), 
                Arrays.<TypeReference<?>>asList(new TypeReference<Utf8String>() {}, new TypeReference<Utf8String>() {}));
        List<Type> results = FunctionReturnDecoder.decode(data, function.getOutputParameters());
        return new Tuple2<String, String>(

                (String) results.get(0).getValue(), 
                (String) results.get(1).getValue()
                );
    }

    public Tuple1<BigInteger> getInsertOutput(TransactionReceipt transactionReceipt) {
        String data = transactionReceipt.getOutput();
        final Function function = new Function(FUNC_INSERT, 
                Arrays.<Type>asList(), 
                Arrays.<TypeReference<?>>asList(new TypeReference<Int256>() {}));
        List<Type> results = FunctionReturnDecoder.decode(data, function.getOutputParameters());
        return new Tuple1<BigInteger>(

                (BigInteger) results.get(0).getValue()
                );
    }

    public Tuple2<List<String>, List<String>> select(String uid) throws ContractException {
        final Function function = new Function(FUNC_SELECT, 
                Arrays.<Type>asList(new org.fisco.bcos.sdk.abi.datatypes.Utf8String(uid)), 
                Arrays.<TypeReference<?>>asList(new TypeReference<DynamicArray<Utf8String>>() {}, new TypeReference<DynamicArray<Utf8String>>() {}));
        List<Type> results = executeCallWithMultipleValueReturn(function);
        return new Tuple2<List<String>, List<String>>(
                convertToNative((List<Utf8String>) results.get(0).getValue()), 
                convertToNative((List<Utf8String>) results.get(1).getValue()));
    }

    public List<InsertResultEventResponse> getInsertResultEvents(TransactionReceipt transactionReceipt) {
        List<Contract.EventValuesWithLog> valueList = extractEventParametersWithLog(INSERTRESULT_EVENT, transactionReceipt);
        ArrayList<InsertResultEventResponse> responses = new ArrayList<InsertResultEventResponse>(valueList.size());
        for (Contract.EventValuesWithLog eventValues : valueList) {
            InsertResultEventResponse typedResponse = new InsertResultEventResponse();
            typedResponse.log = eventValues.getLog();
            typedResponse.count = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue();
            responses.add(typedResponse);
        }
        return responses;
    }

    public void subscribeInsertResultEvent(String fromBlock, String toBlock, List<String> otherTopics, EventCallback callback) {
        String topic0 = eventEncoder.encode(INSERTRESULT_EVENT);
        subscribeEvent(ABI,BINARY,topic0,fromBlock,toBlock,otherTopics,callback);
    }

    public void subscribeInsertResultEvent(EventCallback callback) {
        String topic0 = eventEncoder.encode(INSERTRESULT_EVENT);
        subscribeEvent(ABI,BINARY,topic0,callback);
    }

    public static DetailCRUD load(String contractAddress, Client client, CryptoKeyPair credential) {
        return new DetailCRUD(contractAddress, client, credential);
    }

    public static DetailCRUD deploy(Client client, CryptoKeyPair credential) throws ContractException {
        return deploy(DetailCRUD.class, client, credential, getBinary(client.getCryptoSuite()), "");
    }

    public static class InsertResultEventResponse {
        public TransactionReceipt.Logs log;

        public BigInteger count;
    }
}
